<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>
    
    </div>
    <script>
    /* thead-->获取thead部分
       tbodies-->获取tbody部分 获取的是一个类数组
       rows-->获取tr的集合
     */
     var table=document.getElementById("table");
     table.tHead.style.background="#ff2d51";
     var rows=table.tBodies[0].rows;
     for(var i=0;i < rows.length; i++){
         if(i % 2 == 0){
             rows[i].style.background = "#EEEEEE"
         }else{
            rows[i].style.background = "#44CEF6" 
         }
     }
    </script>
</body>
</html>